package com.leaves.leetcode.string.t1456_MaxVowels;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.leaves.leetcode.UnitTesting;

public class T1456Main extends UnitTesting<Object[], Integer> {

    Solution solution = new Solution();

    @Override
    protected void generateTestData() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            testDataList.add(createTestData(
                    objectMapper.readValue("[\"abciiidef\", 3]", new TypeReference<Object[]>() {}),
                    3
            ));
            testDataList.add(createTestData(
                    objectMapper.readValue("[\"aeiou\", 2]", new TypeReference<Object[]>() {}),
                    2
            ));
            testDataList.add(createTestData(
                    objectMapper.readValue("[\"leetcode\", 3]", new TypeReference<Object[]>() {}),
                    2
            ));
            testDataList.add(createTestData(
                    objectMapper.readValue("[\"rhythms\", 4]", new TypeReference<Object[]>() {}),
                    0
            ));
            testDataList.add(createTestData(
                    objectMapper.readValue("[\"tryhard\", 4]", new TypeReference<Object[]>() {}),
                    1
            ));


        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Integer run(Object[] inputData) {
        String s = (String) inputData[0];
        int k = inputData[1] == null ? 0 : Integer.parseInt(inputData[1].toString());
        return solution.maxVowels(s, k);
    }
}
